package com.tongcao.cn.validator.regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Author:tongcao
 * @Date:2019/4/26 17:26
 * Description:
 */
public final class RegexUtils {

    public static boolean match(String str, String regex) {
        if (str == null || str.length() == 0 || regex == null || regex.length() == 0) {
            return false;
        }
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(str);
        return m.matches();
    }
}